package com.example.demo111111.controller;


import com.example.demo111111.Result.PageResult;
import com.example.demo111111.entity.Category;
import com.example.demo111111.entity.Merchant;
import com.example.demo111111.service.CategoryService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@CrossOrigin
@RestController
@RequestMapping("/category")
public class CategoryController {

    @Resource
    private CategoryService categoryService;

    @PostMapping
    public Boolean save(@RequestBody Category category){

        Boolean result= categoryService.save(category);
        return result;

    }

    @PutMapping
    public Boolean update(@RequestBody Category category){
        Boolean result= categoryService.update(category);
        return result;
    }

    @GetMapping ("/pageQuery")
    public PageResult pageQuery(Category category){
        PageResult pageResult= categoryService.pageQuery(category);
        return pageResult;
    }

    @DeleteMapping
    public Boolean delete(@RequestParam List<Long> ids) {
        Boolean result= categoryService.deltete(ids);
        return result;
    }
}
